Beaker = Button.extend({
	ctor:function(parent, zIndex, tag, callback, back){
		this._super(parent, zIndex, tag, "#beaker/beaker.png", callback, back);
		this.initBeaker();
		this.setTag(tag);
	},
	initBeaker:function(){
		var line = new cc.Sprite("#beaker/beaker_line.png");
		line.setOpacity(0);
		line.setPosition(this.width * 0.5, line.height * 0.5 + 5);
		this.addChild(line, 5, TAG_BEAKER_LINE);
		var label=new cc.Sprite("#equitment/label.png");	
		label.setPosition(this.width*0.5,this.height*0.5);
		this.addChild(label, 5, TAG_BEAKER_LABEL);
		
		//水流
		var current = new cc.Sprite("#equitment/current.png");
		current.setAnchorPoint(1, 1);
		current.setScale(0);
		current.setRotation(15);
		current.setPosition(this.width * 0.5+16, this.height * 0.7 + 40);
		this.addChild(current,5,TAG_CURRENT); 
		
		if(this.getTag()==TAG_BEAKER){
			var title=new cc.Sprite("#equitment/title1.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}else if(this.getTag()==TAG_BEAKER1){
			var title=new cc.Sprite("#equitment/title2.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}
		else if(this.getTag()==TAG_BEAKER2){
			var title=new cc.Sprite("#equitment/title5.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}
		else if(this.getTag()==TAG_BEAKER3){
			var title=new cc.Sprite("#equitment/title1.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}	else if(this.getTag()==TAG_BEAKER4){
			var title=new cc.Sprite("#equitment/title3.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}
		else if(this.getTag()==TAG_BEAKER6){
			var title=new cc.Sprite("#equitment/title4.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}
	
		else{
			var title=new cc.Sprite("#equitment/title1.png");
			title.setPosition(this.width*0.5,this.height*0.5);
			this.addChild(title,5);
		}

		
		var bubble=new cc.Sprite("#beaker/Bubble.png");
		bubble.setOpacity(0);
		bubble.setVisible(false);
		bubble.setPosition(this.width*0.5,this.height*0.5);
		this.addChild(bubble,5,TAG_BEAKER_BUBBLE);
	},
	upLine:function(){
		var line=this.getChildByTag(TAG_BEAKER_LINE);
		var show=cc.fadeTo(0.5,255);
		var moveTo=cc.moveTo(1,cc.p(this.width*0.5,this.height*0.68));
		line.runAction(cc.sequence(cc.delayTime(0.8),show,moveTo));
		//shui liu
		if(this.getTag()==TAG_BEAKER){
		var current=this.getChildByTag(TAG_CURRENT);
		var seq = cc.sequence(cc.scaleTo(0.5,1),cc.delayTime(1.2),cc.fadeTo(0.2,0));
		current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER3){
			var current=this.getChildByTag(TAG_CURRENT);
			var seq = cc.sequence(cc.scaleTo(0.5,1),cc.delayTime(1.2),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER5){
			var current=this.getChildByTag(TAG_CURRENT);
			var seq = cc.sequence(cc.scaleTo(0.5,1),cc.delayTime(1.2),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER7){
			var current=this.getChildByTag(TAG_CURRENT);
			var seq = cc.sequence(cc.scaleTo(0.5,1),cc.delayTime(1.2),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER1){
			var current=this.getChildByTag(TAG_CURRENT);
			current.setPosition(this.width * 0.5+27, this.height * 0.7 + 70);
			current.setRotation(-25);
			var seq = cc.sequence(cc.delayTime(0.8),cc.scaleTo(0.5,4,1),cc.delayTime(0.8),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER4){
			var current=this.getChildByTag(TAG_CURRENT);
			current.setPosition(this.width * 0.5+30, this.height * 0.7 + 72);
			current.setRotation(-25);
			var seq = cc.sequence(cc.delayTime(0.8),cc.scaleTo(0.5,4,1),cc.delayTime(0.8),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER6){
			var current=this.getChildByTag(TAG_CURRENT);
			current.setPosition(this.width * 0.5+27, this.height * 0.7 + 70);
			current.setRotation(-25);
			var seq = cc.sequence(cc.delayTime(0.8),cc.scaleTo(0.5,4,1),cc.delayTime(0.8),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
		else if(this.getTag()==TAG_BEAKER2){
			var current=this.getChildByTag(TAG_CURRENT);
			current.setPosition(this.width * 0.5+26, this.height * 0.7 + 50);
			current.setRotation(-25);
			var seq = cc.sequence(cc.delayTime(0.8),cc.scaleTo(0.5,2.5,1),cc.delayTime(0.8),cc.fadeTo(0.2,0));
			current.runAction(seq);
		}
	},
	move:function(){
		var bezier=cc.bezierTo(1, [cc.p(gg.c_width*1.5,gg.c_height*0.7),cc.p(gg.c_width*1.36,gg.c_height*0.2),cc.p(gg.c_width*1.24,gg.c_height*0.5)]);
		this.runAction(cc.sequence(bezier,cc.callFunc(function(){
			gg.flow.next();
		},this)));
	},
	move1:function(){
		var bezier=cc.bezierTo(1, [cc.p(gg.c_width*1.5,gg.c_height*0.7),cc.p(gg.c_width*1.36,gg.c_height*0.2),cc.p(gg.c_width*1.24,gg.c_height*0.46)]);
		this.runAction(cc.sequence(bezier,cc.callFunc(function(){
			gg.flow.next();
		},this)));
	}
});